<template>
  <div id="app">
    <ul>
      <li v-for="(item,index) in data" :key="index">
        <span>{{item}}</span>
        <button @click="del(index)">删除</button>
      </li>
    </ul>
    <button @click="pro">生成</button>
  </div>
</template>

<script>
export default {
  data(){
    return {
      data:[1,3,5]
    }
  },
  methods : {
    del (index) {
      this.data.splice(index,1)
    },
    pro(){
      let num = Math.floor(Math.random() * 10)
      this.data.push(num)
    },
  }
}
</script>

<style scoped>

</style>